<template>
    <div class="feedback">
        <group class="feedOpinion" :title="('反馈意见')">
            <x-textarea :placeholder="('点击输入')" :max="100" :height="120" v-model="opinion"></x-textarea>
        </group>
        <div class="form-item form-item-style2">
            <div class="label-title space-between">
                <div class="space-between">
                    <label>反馈图片</label>
                    <i class="iconfont icon-required"></i>
                </div>
            </div>
            <div class="upload-wrap">
                <upload @setFormData="setYSFormData"
                        :uploadImgss="hiddenmeta.uploadImgs"
                        :images="hiddenmeta.images"></upload>
            </div>
        </div>
        <div class="btns">
            <button class="subtn" @click="submitHandle">提交</button>
        </div>
        <myMenu></myMenu>
    </div>
</template>
<script>
import myMenu from '@/commonComponents/menu'
import upload from '@/commonComponents/upload/index'
export default {
    name: 'userinfo',
    components: {
        upload,
        myMenu
    },
    data(){
        return {
            userInfo: {},//用户信息
            opinion: '',//意见内容
            YSFormData: '',// 验收后上传图片formData对象
            YSuploadLength: 0, // 验收后上传图片数量
            hiddenmeta: {
                'uploadImgs': [],
                'images': []
            }
        }
    },
    created () {
        this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
    },
    methods: {
        setYSFormData (formData, uploadLength) {
            // console.log(formData)
            this.YSFormData = formData
            this.YSuploadLength = uploadLength
        },
        // 点击提交
        submitHandle () {
            var that = this
            if(this.opinion == ''){
                this.$vux.toast.text('请输入反馈意见！')
                return false;
            }
            var params = {
                'allowPaging': true,
                'business': 'SaveFeedback',
                'data': {
                    'account': this.userInfo.account,
                    'content': this.opinion
                },
                'pageIndex': 0,
                'pageSize': 0,
                'tokenId': '',
                'userId': this.userInfo.userid
            }
            this.$axiosAjax.getConfigJson(params,this.YSFormData)
            .then((res) =>{
                // console.log(res)            
                if(res.data.code == 0){
                    // debugger
                    this.$vux.toast.text('反馈成功！')
                }
            })
            setTimeout(function(){
                that.$router.push('/Index/userinfo')
            },1500)         
        }
    }
}
</script>
<style scoped>
.feedback .btns .subtn{
    width: 200px;
}
</style>
<style>
.feedback .weui-toast_text{
    height: 50px;
}
.feedOpinion{
    margin-bottom: 15px;
}
.feedOpinion .weui-cells__title{
    font-size: 15px;
    color: #333;
    font-weight: bold;
    height: 45px;
    line-height: 45px;
    padding-left: 20px;
}
.feedOpinion .weui-cells{
    margin: 0 20px;
    background-color: #edeff2;
    border-radius: 6px;
}
.feedOpinion .weui-cells:after, .feedOpinion .weui-cells:before{
    display: none;
}
.feedOpinion .weui-textarea{
    background-color: #edeff2;
    font-size: 13px;
}
.feedback .label-title label{
    height: 48px;
    line-height: 48px;
    color: #333;
    font-size: 15px;
    font-weight: bold;
}
.feedback .upload-wrap{
    padding-right: 20px;
}
.feedback .upload-wrap .upload-item{
    margin-right: 26px;
    margin-bottom: 20px;
}
.feedback .label-title .icon-required{
    display: none;
}
.feedback .form-item{
    border-bottom: 0;
}
</style>



